/**
 * Copyright 2010, Lars J. Nilsson <http://www.larsan.net> 
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package net.larsan.dconf.util;

import java.text.ParseException;

import net.larsan.dconf.DPath;

/**
 * Small utility object for paths. Contains only
 * static methods at the moment.
 * 
 * @author Lars J. Nilsson
 */
public class DPaths {

	private DPaths() { }
	
	/**
	 * This method catches any parse exceptions and throws an illegal
	 * state exception instead. Otherwise the path must follow the same
	 * rules as {@link DPath#parse(String)}.
	 * 
	 * @param path Path to parse, must not be null
	 * @return A new path object, never null
	 */
	public static DPath safeParse(String path) {
		try {
			return DPath.parse(path);
		} catch (ParseException e) {
			throw new IllegalStateException(e);
		}
	}
}
